package com.mysen.sso.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mysen.json.JSONObject;
import com.mysen.model.Response;
import com.mysen.sso.util.ValidationConfig;

@RequestMapping("/validate")
@Controller
public class ValidateController {

	private static final Logger LOGGER = LoggerFactory.getLogger(ValidateController.class);

	@GetMapping
	@ResponseBody
	public Response<String> loginValidation(@RequestParam("uri") String uri, @RequestParam("type") String type){
		LOGGER.debug("loginValidation start...");
		JSONObject validobj = ValidationConfig.getValidationConfig(uri, type);
		Response<String> result = new Response<String>();
		result.setData(validobj.toString());
		result.setSuccess(true);
		LOGGER.debug("loginValidation end...");
		return result;
	}
}
